package com.rightin.reader.hf;

/* loaded from: hf_reader.jar:com/rightin/reader/hf/Crc16New.class */
public class Crc16New {
    public static byte[] cal_crc16(byte[] pCrcData, int pLen) {
        int tmpCrc = 65535;
        for (int i = 0; i < pLen; i++) {
            int ib = pCrcData[i] & 255;
            tmpCrc = (tmpCrc ^ ib) & 65535;
            for (int j = 0; j < 8; j++) {
                int itemp = tmpCrc & 1;
                if (itemp != 0) {
                    tmpCrc = ((tmpCrc >> 1) ^ 33800) & 65535;
                } else {
                    tmpCrc >>= 1;
                }
            }
        }
        byte[] abyte0 = {(byte) (255 & tmpCrc), (byte) ((65280 & tmpCrc) >> 8)};
        return abyte0;
    }
}
